﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Data.SqlClient;


/// <summary>
/// Summary description for GenericDAL
/// </summary>
public class GenericDAL
{
    private static string myCS = "Data Source=182.50.141.238; user id = tyros; password = Gits123%; Initial Catalog =SkilledRES;";
    private static SqlConnection myCon = new SqlConnection(myCS);
    private static SqlCommand myCom = new SqlCommand();

    public GenericDAL()
    {
    }

    public static DataTable SetRegistration(string name, string email, string phoneno, string timeslot, string regtype, int mail)
    {
        myCom = new SqlCommand();
        DataTable myDt = new DataTable();
        SqlDataAdapter myAdp = new SqlDataAdapter(myCom);
        myCom.Connection = myCon;
        myCom.CommandText = "sp_GetSetRegistration";
        myCom.CommandType = CommandType.StoredProcedure;
        myCom.Parameters.AddWithValue("@vc_name", name);
        myCom.Parameters.AddWithValue("@vc_email", email);
        myCom.Parameters.AddWithValue("@vc_phone", phoneno);
        myCom.Parameters.AddWithValue("@vc_timeslot", timeslot);
        myCom.Parameters.AddWithValue("@vc_regtype", regtype);
        myCom.Parameters.AddWithValue("@int_interestedinmails", mail);
        myCom.Parameters.AddWithValue("@int_processtype", 1);

        try
        {
            myAdp.Fill(myDt);
        }
        catch (Exception ex)
        {
        }

        return myDt;
    }

    public static DataTable SetSubscription(string name, string email)
    {
        myCom = new SqlCommand();
        DataTable myDt = new DataTable();
        SqlDataAdapter myAdp = new SqlDataAdapter(myCom);
        myCom.Connection = myCon;
        myCom.CommandText = "sp_GetSetSubscription";
        myCom.CommandType = CommandType.StoredProcedure;
        myCom.Parameters.AddWithValue("@vc_name", name);
        myCom.Parameters.AddWithValue("@vc_email", email);

        try
        {
            myAdp.Fill(myDt);
        }
        catch (Exception ex)
        {
        }

        return myDt;
    }
}